package cn.jingyuan.swan.system.web.controller.sys;

import cn.jingyuan.swan.cloud.core.Result;
import cn.jingyuan.swan.cloud.core.ResultUtils;
import cn.jingyuan.swan.system.model.UserAccount;
import cn.jingyuan.swan.system.service.UserService;
import cn.jingyuan.swan.system.web.restful.UserRestful;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@Api(tags = "用户接口")
@Slf4j
@RestController
public class UserController implements UserRestful {

    @Resource
    UserService userService;

    @ApiOperation(value = "获取登录账号信息（用于登录）", notes = "标识为登录业务")
    @Override
    public Result<UserAccount> userLogin(Map<String, String> params) {
        String username = params.get("username");
        UserAccount userAccount = userService.userLogin(username);
        return ResultUtils.ok(userAccount);
    }

}
